<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="送货单一览表" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillList.css" />
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doShow(id){
		var url="/business/DeliverBillEdit.ihtm?id="+id;
		ShowIframe("送货单",url,1024,500,"refreshWin()",1024,600);
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location=window.location;
		}
	}
	function checkDateStr(){
		var startDate=document.getElementById("start_date").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择送货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','送货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','送货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("end_date").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择送货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','送货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','送货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function createPageParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("end_date").value);
		
		var examined="A";
		if(document.getElementById("examine1").checked){
			examined="Y";
		}else if(document.getElementById("examine2").checked){
			examined="N";
		}
		str=str+"&examined="+examined;
		
		var send="A";
		if(document.getElementById("send1").checked){
			send="Y";
		}else if(document.getElementById("send2").checked){
			send="N";
		}
		str=str+"&send="+send;
		
		var deli="A";
		if(document.getElementById("deli1").checked){
			deli="OK";
		}else if(document.getElementById("deli2").checked){
			deli="TO";
		}
		str=str+"&deli="+deli;
		
		str=str+"&creater_name="+encodeURIComponent(document.getElementById("creater_name").value);
		str=str+"&sender_name="+encodeURIComponent(document.getElementById("sender_name").value);
		str=str+"&manager_name="+encodeURIComponent(document.getElementById("manager_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("est_name").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("bill_code").value);
		str=str+"&content="+encodeURIComponent(document.getElementById("content").value);
		str=str+"&department="+document.getElementById("department").value;
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("bb_code").value);
		str=str+"&ts_id="+document.getElementById("ts_id").value;
		str=str+"&order_by="+document.getElementById("order_by").value;
		str=str+"&order_sc="+document.getElementById("order_sc").value;
		
		return str;
	}
	
	function createProgramParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("hid_start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("hid_end_date").value);
		str=str+"&examined=${examined}";
		str=str+"&send=${send}";
		str=str+"&deli=${deli}";
		str=str+"&manager_name="+encodeURIComponent(document.getElementById("hid_manager_name").value);
		str=str+"&creater_name="+encodeURIComponent(document.getElementById("hid_creater_name").value);
		str=str+"&sender_name="+encodeURIComponent(document.getElementById("hid_sender_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("hid_est_name").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("hid_bill_code").value);
		str=str+"&content="+encodeURIComponent(document.getElementById("hid_content").value);
		str=str+"&department=${department}";
		str=str+"&bb_code="+encodeURIComponent(document.getElementById("hid_bb_code").value);
		str=str+"&ts_id=${tsId}";
		str=str+"&order_by=${orderBy}";
		str=str+"&order_sc=${orderSc}";
		
		return str;
	}
	
	function doSearch(){
		var str;
		if(IsAdvSearch){//高级
			str="search_type=1";
			
			if(document.getElementById("cb_deliver_date").checked){
				if(checkDateStr()){
					str=str+"&cb_deliver_date=1";
				}else{
					return;
				}
			}
			
			if(document.getElementById("cb_examine").checked){
				str=str+"&cb_examine=1";
			}
			if(document.getElementById("cb_send").checked){
				str=str+"&cb_send=1";
			}
			if(document.getElementById("cb_deli").checked){
				str=str+"&cb_deli=1";
			}
			if(document.getElementById("cb_manager").checked){
				var managerName=document.getElementById("manager_name").value.trim();
				if(managerName==null || managerName==""){
					ShowAlert('提示框','请输入业务员姓名',200,100);
					return;
				}
				str=str+"&cb_manager=1";
			}
			
			if(document.getElementById("cb_creater").checked){
				var createrName=document.getElementById("creater_name").value.trim();
				if(createrName==null || createrName==""){
					ShowAlert('提示框','请输入开单人姓名',200,100);
					return;
				}
				str=str+"&cb_creater=1";
			}
			if(document.getElementById("cb_sender").checked){
				var senderName=document.getElementById("sender_name").value.trim();
				if(senderName==null || senderName==""){
					ShowAlert('提示框','请输入送货人姓名',200,100);
					return;
				}
				str=str+"&cb_sender=1";
			}
			if(document.getElementById("cb_est").checked){
				var estName=document.getElementById("est_name").value.trim();
				if(estName==null || estName==""){
					ShowAlert('提示框','请输入订货单位',200,100);
					return;
				}
				str=str+"&cb_est=1";
			}
			
			if(document.getElementById("cb_bill_code").checked){
				var billCode=document.getElementById("bill_code").value.trim();
				if(billCode==null || billCode==""){
					ShowAlert('提示框','请输入送货单号',200,100);
					return;
				}
				str=str+"&cb_bill_code=1";
			}
			if(document.getElementById("cb_content").checked){
				var content=document.getElementById("content").value.trim();
				if(content==null || content==""){
					ShowAlert('提示框','请输入摘要',200,100);
					return;
				}
				str=str+"&cb_content=1";
			}
			if(document.getElementById("cb_dep").checked){
				var department=document.getElementById("department").value;
				if(department==null || department=="" || department=="0"){
					ShowAlert('提示框','请选择部门',200,100);
					return;
				}
				str=str+"&cb_dep=1";
			}
			
			if(document.getElementById("cb_bb_code").checked){
				var bbCode=document.getElementById("bb_code").value.trim();
				if(bbCode==null || bbCode==""){
					ShowAlert('提示框','请输入业务单号',200,100);
					return;
				}
				str=str+"&cb_bb_code=1";
			}
			
			if(document.getElementById("cb_ts").checked){
				var tsId=document.getElementById("ts_id").value;
				if(tsId==null || tsId=="" || tsId=="0"){
					ShowAlert('提示框','请选择帐套',200,100);
					return;
				}
				str=str+"&cb_ts=1";
			}
			if(document.getElementById("cb_order").checked){
				var orderBy=document.getElementById("order_by").value;
				if(orderBy==null || orderBy==""){
					ShowAlert('提示框','请选择排序类型',200,100);
					return;
				}
				str=str+"&cb_order=1";
			}
		}else{//快速
			str="search_type=2";
			if(!checkDateStr()){
				return;
			}
		}
		
		var paraStr=createPageParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		window.location="/business/DeliverBillSearchResult.ihtm?"+str;
	}
	function doGo(pageIndex){
		var str=getSearchCondition();
		str=str+"&current_page="+pageIndex;
		window.location="/business/DeliverBillSearchResult.ihtm?"+str;
	}
	
	function getSearchCondition(){
		var searchType="${searchType}";
		var str="search_type="+searchType;
		if(searchType=="1"){//高级
			<c:if test="${cbDeliverDate=='1'}">str=str+"&cb_deliver_date=1";</c:if>
			<c:if test="${cbExamine=='1'}">str=str+"&cb_examine=1";</c:if>
			<c:if test="${cbSend=='1'}">str=str+"&cb_send=1";</c:if>
			<c:if test="${cbDeli=='1'}">str=str+"&cb_deli=1";</c:if>
			<c:if test="${cbCreater=='1'}">str=str+"&cb_creater=1";</c:if>
			<c:if test="${cbSender=='1'}">str=str+"&cb_sender=1";</c:if>
			<c:if test="${cbManager=='1'}">str=str+"&cb_manager=1";</c:if>
			<c:if test="${cbEst=='1'}">str=str+"&cb_est=1";</c:if>
			<c:if test="${cbBillCode=='1'}">str=str+"&cb_bill_code=1";</c:if>
			<c:if test="${cbContent=='1'}">str=str+"&cb_content=1";</c:if>
			<c:if test="${cbDep=='1'}">str=str+"&cb_dep=1";</c:if>
			<c:if test="${cbBbCode=='1'}">str=str+"&cb_bb_code=1";</c:if>
			<c:if test="${cbTs=='1'}">str=str+"&cb_ts=1";</c:if>
			<c:if test="${cbOrder=='1'}">str=str+"&cb_order=1";</c:if>
		}else{//快速
			
		}
		
		var paraStr=createProgramParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		
		return str;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		if(ob_arr.length>=it.getAttribute("index")){
			str=ob_arr[it.getAttribute("index")-1].value;
		}
		if(str==""){
			return;
		}
		doShow(str);
	}
	function doDownload(){
		var str=getSearchCondition();
		window.location="/business/DeliverBillSearchResult.ihtm?content_type=EXCEL&"+str;
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		//Window_Onload();
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function doAutoCheck(objId){
		document.getElementById(objId).checked=true;
	}
	function doPrint(id,favCost){
		<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_BUSI_COST;')==-1}">
		//if(favCost==0){
			ShowConfirm('确认框','送货单打印金额？',340,80,"doPrintCallBack("+id+")");
		//}
		</c:if>
		<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_BUSI_COST;')!=-1}">
			showWin(900,600,"/business/DeliverBillPrint.ihtm?id="+id);
		</c:if>
	}
	function doPrintCallBack(id){
		var printCost="0";
		if(popRetVal!=null){
			printCost="1";
		}
		showWin(900,600,"/business/DeliverBillPrint.ihtm?id="+id+"&print_cost="+printCost);
	}
	function selectStafferName(objId,checkObjId){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"selectStafferNameCallBack('"+objId+"','"+checkObjId+"')");
	}
	function selectStafferNameCallBack(objId,checkObjId){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById(objId).value=arr[1];
			doAutoCheck(checkObjId);
		}
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="TODAY"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="YESTERDAY"){
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
		doAutoCheck("cb_deliver_date");
	}
	function showExaPage(id){
		var url="/business/DeliverBillInfoForExamine.ihtm?id="+id;
		ShowIframe("审核",url,900,500,"refreshWin()");
	}
	function showUnExaPage(id){
		var url="/business/DeliverBillInfoForUnExamine.ihtm?id="+id;
		ShowIframe("反审核",url,900,500,"refreshWin()");
	}
	function doMultiPrint(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		for (i=0;i<ob_arr.length;i++){
			if(ob_arr[i].checked == true){
				if(str!=""){
					str=str+";";
				}
				str = str+ob_arr[i].value;
			}
		}
		if(str!=""){
			<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_BUSI_COST;')==-1}">
				ShowConfirm('确认框','送货单打印金额？',340,80,"doMultiPrintCallBack('"+str+"')");
			</c:if>
			<c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_BUSI_COST;')!=-1}">
				showWin(900,600,"/business/DeliverBillPrintMulti.ihtm?id="+str);
			</c:if>
		}else{
			ShowAlert('提示框','请选择要打印的送货单',200,100);
		}
	}
	function doMultiPrintCallBack(id){
		var printCost="0";
		if(popRetVal!=null){
			printCost="1";
		}
		showWin(900,600,"/business/DeliverBillPrintMulti.ihtm?id="+id+"&print_cost="+printCost);
	}
	function selectEstName(){
		var url="/base/EstablishmentListForSelect.ihtm?type=CLIENT";
		ShowIframe("选择客户",url,900,500,"selectEstNameCallBack()");
	}
	function selectEstNameCallBack(){
		if(popRetVal!=null){
			document.getElementById("est_name").value=popRetVal[1];
			doAutoCheck("cb_est");
		}
	}
	function doEditDeli(id){
		var url="/business/SetDeliCodeForm.ihtm?bill_id="+id;
		ShowIframeNoScroll("填物流单号",url,360,240,"refreshWin()");
	}
</script>
</head>
<c:set var="canExa" value="N" />
<c:set var="canUnExa" value="N" />
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';DELI_EXAM;')!=-1}"><c:set var="canExa" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';DELI_UN_EXAM;')!=-1}"><c:set var="canUnExa" value="Y" /></c:if>
<body oncontextmenu="return false">
<div class="Wrap"><!-- 页面主框架 -->
    
	<div id="ListContainer" class="Container"><!-- 主体容器 -->
	    
	    <!-- 标题栏 -->
	    <div class="Heading BillIcon">
	        <div class="HeadingContent">
	            <h1>送货单一览表</h1>
	            <span class="Note">通过查询送货单，可以对送货单进行编辑与打印，同个客户的送货单可以自动合并成一张单打印，<span style="color:black">黑色</span>表示未审核、<span style="color:blue">蓝色</span>表示已审核、<span style="color:green">绿色</span>表示已送出</span>
	        </div>
	    </div>
	
		<!-- 主内容 -->
		<div class="Content">
	        <!-- 筛选控件栏 -->
	        <div class="FilterBar ClearFix">
	            <div class="SearchIcon"></div>
	            <span class="fl">
	            	<table class="MoreOption" cellpadding="0" cellspacing="0">
	            		<th class="c1" width="80px">
	            			<input type="checkbox" name="cb_deliver_date" id="cb_deliver_date" <c:if test="${cbDeliverDate=='1' || searchType=='2'}">checked="true"</c:if> style="visibility:hidden;" />
	            			送货日期
	            		</th>
	            		<td width="360px">
	            			<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_deliver_date');" id="start_date" name="start_date" value="<c:out value="${startDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_deliver_date\')');">
			            	<input type="hidden" id="hid_start_date" value="<c:out value="${startDate}" />">
			            	至
			            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_deliver_date');" id="end_date" name="end_date" value="<c:out value="${endDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_deliver_date\')');">
			            	<input type="hidden" id="hid_end_date" value="<c:out value="${endDate}" />">
			            	<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
							<a href="javascript:setDate('TODAY');">今天</a>
							<a href="javascript:setDate('YESTERDAY');">昨天</a>
							<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
	            		</td>
	            	</table>
	            </span>
				<span class="fr">
	            	<a href="javascript:;" id="lnkMoreOption">更多查询选项</a>
		  			<input type="button" value=" 查 询" onClick="doSearch();" class="buttom search-but" id="sSearchButton" name="sSearchButton">
		  			<input type="button" value=" 导 出" onClick="doDownload();" class="buttom search-out" id="sDownloadButton" name="sDownloadButton" <c:if test="${currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_EXPO;')!=-1}">disabled="true"</c:if>>
		  			<input type="button" value=" 打 印" onClick="doMultiPrint();" class="buttom search-print" id="sPrintButton" name="sPrintButton">
	            </span>
				<div id="dvMoreOptionBox" class="MoreOptionBox" style="display:none;">
					<table class="MoreOption" cellpadding="0" cellspacing="0">
						<tr>
							<th class="c1" width="80px">
			        			<input type="checkbox" name="cb_est" id="cb_est" <c:if test="${cbEst=='1'}">checked="true"</c:if>>
			        			订货单位
			        		</th>
			    			<td class="c1" width="260px">
			        			<input type="text" class="TextBox" maxlength="50" name="est_name" id="est_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_est');" value="<c:out value="${estName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectEstName();" />
								<input type="hidden" id="hid_est_name" value="<c:out value="${estName}" />">
			    			</td>
			    			<th class="c2" width="80px">
			        			<input type="checkbox" name="cb_examine" id="cb_examine" <c:if test="${cbExamine=='1'}">checked="true"</c:if>>
			        			审核状态
			        		</th>
			    			<td class="c2" width="280px">
			        			<input type="radio" name="examined" id="examine1" onClick="doAutoCheck('cb_examine');" <c:if test="${examined==null || examined=='' || examined=='Y'}">checked="true"</c:if>>已审核
								<input type="radio" name="examined" id="examine2" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='N'}">checked="true"</c:if>>未审核
								<input type="radio" name="examined" id="examine3" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='A'}">checked="true"</c:if>>全部
			    			</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_bill_code" id="cb_bill_code" <c:if test="${cbBillCode=='1'}">checked="true"</c:if>>
			        			送货单号
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="bill_code" id="bill_code" onFocus="doAutoCheck('cb_bill_code');" onKeyUp="checkInput();" value="<c:out value="${billCode}" />">
								<input type="hidden" id="hid_bill_code" value="<c:out value="${billCode}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_send" id="cb_send" <c:if test="${cbSend=='1'}">checked="true"</c:if>>
			        			送货状态
			        		</th>
			    			<td class="c2">
			        			<input type="radio" name="send" id="send1" onClick="doAutoCheck('cb_send');" <c:if test="${send=='Y'}">checked="true"</c:if>>已送出
								<input type="radio" name="send" id="send2" onClick="doAutoCheck('cb_send');" <c:if test="${send=='N'}">checked="true"</c:if>>未送出
								<input type="radio" name="send" id="send3" onClick="doAutoCheck('cb_send');" <c:if test="${send==null || send=='' || send=='A'}">checked="true"</c:if>>全部
			    			</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_content" id="cb_content" <c:if test="${cbContent=='1'}">checked="true"</c:if>>
			        			摘要
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="content" id="content" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_content');" value="${content}" >
								<input type="hidden" id="hid_content" value="<c:out value="${content}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_deli" id="cb_deli" <c:if test="${cbDeli=='1'}">checked="true"</c:if>>
			        			交货
			        		</th>
			    			<td class="c2">
			        			<input type="radio" name="deli" id="deli1" onClick="doAutoCheck('cb_deli');" <c:if test="${deli=='OK'}">checked="true"</c:if>>按时
								<input type="radio" name="deli" id="deli2" onClick="doAutoCheck('cb_deli');" <c:if test="${deli=='TO'}">checked="true"</c:if>>超期
								<input type="radio" name="deli" id="deli3" onClick="doAutoCheck('cb_deli');" <c:if test="${deli==null || deli=='' || deli=='A'}">checked="true"</c:if>>全部
			    			</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_bb_code" id="cb_bb_code" <c:if test="${cbBbCode=='1'}">checked="true"</c:if>>
			        			业务单号
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="bb_code" id="bb_code" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_bb_code');" value="<c:out value="${bbCode}" />">
								<input type="hidden" id="hid_bb_code" value="<c:out value="${bbCode}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_manager" id="cb_manager" <c:if test="${cbManager=='1'}">checked="true"</c:if>>
			        			业务员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="manager_name" id="manager_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_manager');" value="<c:out value="${managerName}" />">
			        			<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('manager_name','cb_manager');" />
								<input type="hidden" id="hid_manager_name" value="<c:out value="${managerName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_dep" id="cb_dep" <c:if test="${cbDep=='1'}">checked="true"</c:if>>
			        			部门
			        		</th>
			    			<td class="c1">
			        			<select name="department" id="department" onFocus="doAutoCheck('cb_dep');">
									<option value="0">==请选择==</option>
									<commonTag:createSelectTree list="${departmentList}" emptyOption="0" defaultValue="${department}" />
								</select>
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_creater" id="cb_creater" <c:if test="${cbCreater=='1'}">checked="true"</c:if>>
			        			开单人
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="creater_name" id="creater_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_creater');" value="<c:out value="${createrName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('creater_name','cb_creater');" />
								<input type="hidden" id="hid_creater_name" value="<c:out value="${createrName}" />">
			    			</td>
						</tr>
						<tr>
							<th class="c1">
			        			<input type="checkbox" name="cb_ts" id="cb_ts" <c:if test="${cbTs=='1'}">checked="true"</c:if>>
	                        	账套
			        		</th>
			    			<td class="c1">
			        			<select name="ts_id" id="ts_id" onFocus="doAutoCheck('cb_ts');">
				    				<option value="0">==请选择账套==</option>
				    				<c:forEach var="item" items="${tsList}">
									<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option></c:forEach>
								</select>
			        		</td>
			        		<th class="c2">
			        			<input type="checkbox" name="cb_sender" id="cb_sender" <c:if test="${cbSender=='1'}">checked="true"</c:if>>
			        			送货人
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="sender_name" id="sender_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_sender');" value="<c:out value="${senderName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('sender_name','cb_sender');" />
								<input type="hidden" id="hid_sender_name" value="<c:out value="${senderName}" />">
			    			</td>
						</tr>
					</table>
					
					<div class="OptionOrderBy">
						<input type="checkbox" name="cb_order" id="cb_order" <c:if test="${cbOrder=='1'}">checked="true"</c:if>>
	                    	排序类型
	                    <select name="order_by" id="order_by" onFocus="doAutoCheck('cb_order');">
						  	<option value="">==请选择==</option>
						  	<option value="DELIVER_DATE" <c:if test="${orderBy=='DELIVER_DATE'}">selected</c:if>>送货日期</option>
						  	<option value="BILL_CODE" <c:if test="${orderBy=='BILL_CODE'}">selected</c:if>>送货单号</option>
						  	<option value="BB_CODE" <c:if test="${orderBy=='BB_CODE'}">selected</c:if>>业务单号</option>
						  	<option value="CONTENT" <c:if test="${orderBy=='CONTENT'}">selected</c:if>>摘要</option>
						  	<option value="EST_NAME" <c:if test="${orderBy=='EST_NAME'}">selected</c:if>>订货单位</option>
				  		</select>
	                    <select name="order_sc" id="order_sc" onFocus="doAutoCheck('cb_order');">
	                        <option value="ASC" <c:if test="${orderSc=='ASC'}">selected</c:if>>升序</option>
	                        <option value="DESC" <c:if test="${orderSc=='DESC'}">selected</c:if>>降序</option>
	                    </select>
						<span class="fr"><a href="javascript:;" id="lnkHiddenOption">隐藏查询选项</a></span>
	                </div>
				</div>
			</div>
			
			<!-- 提示信息显示栏 -->
	        <div class="MsgBar">
	            <%@include file="../inc/AlertMsg.jsp"%>
	        </div>
			<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_BUSI_COST;')==-1 && fn:indexOf(currentUser.privs,';NO_TOTA;')==-1}">
			<div class="TopToolBar">
				<table class="ListNoteInfo" cellpadding="0" cellspacing="0">
	            	<tr>
	                	<td>送货金额合计：${costTotal}元</td>
	            	</tr>
	            </table>
			</div>
			</c:if>
			<div class="table-list">
		  		<table width="100%">      
					<tr >	
						<th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th>
						<th width="10%">单号</td>
						<th width="8%">送货日期</th>
						<th width="10%">订货单位</th>
						<th width="10%">业务单号</td>
						<th width="8%">计划日期</th>
						<th width="10%">摘要</td>
						<th width="10%">物流单号</th>
						<th width="7%">业务员</th>
						<th width="7%">开单人</th>
						<th width="7%">送货人</th>
						<th width="5%">状态</th>
						<th width="8%">操作</th>
					</tr>
					<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="black" />
					<c:if test="${item[0].examined=='Y'}"><c:set var="defaultFontColor" value="blue" /></c:if>
					<c:if test="${item[0].examined=='Y' && item[0].sended=='Y'}"><c:set var="defaultFontColor" value="green" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style="color:${defaultFontColor};cursor:pointer;" defaultFontColor="${defaultFontColor}" ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this,true)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td><input type="checkbox" name='query_checkbox' onClick="javascript:ClickCheck(this,true);" value="${item[0].id}" est_id="${item[5]}"></td>
						<td>${item[0].billCode}</td>
						<td><fmt:formatDate value="${item[0].deliverDate}" pattern="yyyy-MM-dd"/></td>
						<td>${item[1]}</td>
						<td>${item[2]}</td>
						<td><c:if test="${item[6]!=null}"><fmt:formatDate value="${item[6]}" pattern="yyyy-MM-dd"/></c:if></td>
						<td>${item[0].content}</td>
						<td>${item[0].deliComp}<br>${item[0].deliCode}</td>
						<td>${item[4]}</td>
						<td>${item[0].createrName}</td>
						<td><c:if test="${item[0].examined=='Y' && item[0].sended=='Y'}">${item[0].senderName}</c:if></td>
						<td>
							<c:if test="${item[0].examined=='Y'}"><c:if test="${canUnExa=='Y'}"><a href="javascript:showUnExaPage('${item[0].id}');"></c:if>已审核<c:if test="${canUnExa=='Y'}"></a></c:if></c:if>
							<c:if test="${item[0].examined=='N'}"><c:if test="${canExa=='Y'}"><a href="javascript:showExaPage('${item[0].id}');"></c:if>未审核<c:if test="${canExa=='Y'}"></a></c:if></c:if>
							<br>
							<c:if test="${item[0].examined=='Y' && item[0].sended=='Y'}">已送出</c:if>
							<c:if test="${item[0].examined=='N' || item[0].sended=='N'}">未送出</c:if>
						</td>
						<td>
							<a href="javascript:doShow('${item[0].id}');">修改</a>
							<a href="javascript:doPrint('${item[0].id}',${item[3]});">打印</a>
							<br>
							<a href="javascript:doEditDeli('${item[0].id}');">填物流单号</a>
						</td>
					</tr>
					</c:forEach>
				</table>
			</div>

			<!-- 底栏 分页、操作等 -->
	        <div class="BottomToolBar ClearFix">
			    <%@include file="../inc/Pages.jsp"%>
	        </div>
			
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	function ChangeWindowSize( container, maxWidth ){
	    setTimeout( function(){
	        var w1 = document.documentElement.clientWidth-40;
	        if( w1>maxWidth ) w1 = maxWidth;
	        else if( w1<970 ) w1 = 960;
	        container.style.width = w1+'px';
	    }, 300 );
	}
	var IsAdvSearch = false;
	(function(){
		doInit();
	    var ListContainer = document.getElementById('ListContainer');
	    ChangeWindowSize( ListContainer, 2020 );    // 超过 1280 的最大 1260 ，不全部铺满
	
	    var lnkMoreOption   = document.getElementById('lnkMoreOption');
	    var lnkHiddenOption = document.getElementById('lnkHiddenOption');
	    lnkMoreOption.onclick = function(){
	    	IsAdvSearch = true;
	        document.getElementById('dvMoreOptionBox').style.display = 'block';
	        document.getElementById('cb_deliver_date').style.visibility = 'visible';
	        this.style.visibility = 'hidden';
	    };
	    lnkHiddenOption.onclick = function(){
	    	IsAdvSearch = false;
	        document.getElementById('dvMoreOptionBox').style.display = 'none';
	        document.getElementById('cb_deliver_date').style.visibility = 'hidden';
	        lnkMoreOption.style.visibility = 'visible';
	    };
	})();
</script>
